package com.MyApp.CompanyRank;

import java.net.URLDecoder;
import java.net.URLEncoder;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;

public class Mytest {

    public static void main(String[] args) throws UnsupportedEncodingException {
        String s = "🍂 ";
//        s = URLDecoder.decode(s, "utf8");
//        s = URLEncoder.encode(s, "utf8mb4");
        
        // 驱动程序名
        String driver = "com.mysql.jdbc.Driver";
        // URL指向要访问的数据库名scutcs
        String url = "jdbc:mysql://192.168.1.220:3306/ider";
        // MySQL配置时的用户名
        String user = "root";
        // MySQL配置时的密码
        String password = "root";
        try {
            // 加载驱动程序
            Class.forName(driver);
            // 连续数据库
            Connection conn = DriverManager.getConnection(url, user, password);
            if (!conn.isClosed())
                System.out.println("Succeeded connecting to the Database!");
            // statement用来执行SQL语句
            // Statement statement = conn.createStatement();
            // // 要执行的SQL语句
            // String sql = "select * from student";
            // // 结果集
            // ResultSet rs = statement.executeQuery(sql);
            PreparedStatement ps = null;
            String Sql = "INSERT INTO testider VALUES(?,?,?)";
            ps = conn.prepareStatement(Sql);
            ps.setInt(1, 31);
            ps.setString(2, "hello");
            ps.setBytes(3, s.getBytes());
            ps.executeUpdate();
//            conn.commit();
            // rs.close();
            conn.close();

        } catch (Exception e) {
            e.printStackTrace();

        }

        int a = 932400011;
        long c = a;
//        String s = "🍂 #HarvardinAutumn 🍂 http://hvrd.me/TgzlO";

        System.out.println(URLDecoder.decode(s, "utf8"));
    }

}
